home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
A-COMAL Series
/
(k)aac.d64
/
basic-sieve
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-28
|
464b
|
25 lines
10 PRINT CHR$(147),"SIEVE TEST"
20 SI%=1000:ML%=10
30 PRINT "ARRAY SIZE: ";SI%
40 PRINT "NUMBER ITERATIONS: ";ML%
100 POKE 162,0:POKE 161,0:POKE 160,0
120 DIM FL%(SI%)
125 FOR NB=1 TO ML%
130 FOR I=0 TO SI%:FL%(I)=1:NEXT
140 PRINT "LOOP ";NB
150 CT%=0
160 FOR I=0 TO SI%
170 IF FL%(I)=0 THEN 250
180 PR%=I+I+3
190 K%=I+PR%
200 IF K%>SI% THEN 240
210 FL%(K%)=0
220 K%=K%+PR%
230 GOTO 200
240 CT%=CT%+1
250 NEXT
252 NEXT
255 PRINT "COUNT=";CT%
260 T3=PEEK(162):T2=PEEK(161):T1=PEEK(160)
270 PRINT (T1*256*256+T2*256+T3)/60;" SECONDS"